<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="./page.css">
</head>
<body>
    <table border="1" cellspacing="0" style="margin:0 auto">
        <thead>
            <tr>
            <th>序号</th>
            <th>学生ID</th>
            <th>学生姓名</th>
            <th>学生年龄</th>
            <th>学生性别</th>
            <th>学生班级</th>
            <th>学生成绩</th>
            </tr>
        </thead>
        <tbody></tbody>
    </table>
    <div class="page1"></div>    <!--分页 -->


    <script src="./tablePage.js"></script>

    <script src="./page.js"></script>
    <script>
    let page1 = new Page('.page1', {
        // 
        pageTag: {
            first: '首页',
            prev: '上一页',
            list: null,
            next: '下一页',
            last: '末页',
        },
        pageInfo: {
            pageNum: 1,     // 当前页数
            pageSize: 10,    // 每页显示条数  
            totalData: 1000, // 总条数 
            // totalPage: 4,  // 总页数 = 向上取整（总条数 / 每页显示条数）
        },
        callback(pagenum){
            let pageSize = 10;
            let startNum = (pagenum-1)*pagesize;
            let html='';
            for(let i=startNum;i<pagenum*pagesize;i++){
                html+=`
                    <tr>
                    <td></td>
                    <td>${tableDataArr[i].id}</td>
                    <td>${tableDataArr[i].name}</td>
                    <td>${tableDataArr[i].age}</td>
                    <td>${tableDataArr[i].gender}</td>
                    <td>${tableDataArr[i].class}</td>
                    <td>${tableDataArr[i].score}</td>
                    </tr>
                `
            }
            document.querySelector('tbody').innerHTML=html;
        }
    })
    </script>
</body>
</html>